﻿@{
    Layout = null;
}
@model Freshbox2._0.MODEL.user
<!DOCTYPE html>

<html>
<head>
        <link rel="shortcut icon" href="favicon.ico">
     <link rel="icon" type="image/gif" href="~/img/animated_favicon1.gif">
    <meta name="viewport" content="width=device-width" />
    <link href="~/UILibs/easyui/themes/default/easyui.css" rel="stylesheet" />
    <link href="~/UILibs/easyui/themes/icon.css" rel="stylesheet" />
    <link href="~/Css/css.css" rel="stylesheet" />

    <script src="~/Scripts/jquery-1.7.1.min.js"></script>
    <script src="~/UILibs/easyui/jquery.easyui.min.js"></script>
    <script src="~/UILibs/easyui/locale/easyui-lang-zh_CN.js"></script>

    <script src="~/Scripts/jquery.unobtrusive-ajax.min.js"></script>
    <script src="~/Scripts/jquery.validate.min.js"></script>
    <script src="~/Scripts/jquery.validate.unobtrusive.min.js"></script>
    <title></title> 
    <script type="text/javascript">
        $(function () {
            $.ajax({
                url: " /Users/GetAllOrToday",
                dataType: "JSON",
                type: "GET",
                success: function (data) {
                    $("#txtToday").val(data.todaySum + "  人");
                    $("#txtAll").val(data.allSum + "  人"); 
                    $("#txtFace").val(data.faceNum + "  人");
                }
            });
        });

        $(function () {
            $("#data").datagrid({
                fit: true,
                title: '客户信息列表',
                striped: true,
                rownumbers: true,
                columns:
                    [[{
                        field: 'ck',
                        checkbox: true
                    }, {
                        field: 'userCode',
                        title: '用户编号',
                        width: 100,
                        height: 50,
                        halign: 'center',
                        sortable: true,
                        align: 'center'
                    }, {
                        field: 'userName',
                        title: '用户姓名',
                        width: 100,
                        height: 50,
                        halign: 'center',
                        align: 'center',

                    }, {
                        field: 'wechatCode',
                        title: '微信号',
                        width: 250,
                        height: 50,
                        halign: 'center',
                        align: 'center'
                    }, {
                        field: 'wechatName',
                        title: '微信名称',
                        width: 150,
                        height: 50,
                        halign: 'center',
                        align: 'center'
                    }, {
                        field: 'userPhone',
                        title: '用户手机号',
                        width: 150,
                        height: 50,
                        halign: 'center',
                        align: 'center',

                    }, {
                        field: 'userSex',
                        title: '性别',
                        width: 100,
                        height: 50,
                        halign: 'center',
                        align: 'center'
                    }, {
                        field: 'userState',
                        title: '用户状态',
                        width: 100,
                        height: 50,
                        halign: 'center',
                        align: 'center'
                    }, {
                        field: 'userMemberstatus',
                        title: '人脸识别状态',
                        width: 150,
                        height: 50,
                        halign: 'center',
                        align: 'center',

                    }, {
                        field: 'memberExp',
                        title: '积分',
                        width: 100,
                        height: 50,
                        halign: 'center',
                        align: 'center'
                    }, {
                        field: 'memberBalance',
                        title: '余额',
                        width: 100,
                        height: 50,
                        halign: 'center',
                        align: 'center'
                    },
                    ]],

                url: pageConfig.getAction,
                pagination: true,
                pageSize: 25,
                pageList: [25, 30, 35],
                sortName: 'userCode',
                sortOrder: 'desc',
                toolbar: '#tool',
            });
        });
        var pageConfig = {
            type: null,
            getAction: '@Url.Action("GetUsers")',
            saveAction: '@Url.Action("Save")',
            delAction: '@Url.Action("ModifyState")',
            modifyAction: '@Url.Action("Modify")',
            getOneAction: '@Url.Action("GetOnlyOne")',
        };
        ///禁用用户   状态改变               
        function del() {
            var rows = $("#data").datagrid("getSelections")
            if (rows.length <= 0) {
                $.messager.alert("禁用用户", "没有选中的行", "info");
                return;
            }
            $.messager.confirm("确定操作", "您确定要禁用该用户吗？", function (flag) {
                if (flag) {
                    var idsStr = rows[0].userCode;
                    $.ajax({
                        url: pageConfig.delAction,
                        data: { id: idsStr },
                        dataType: "json",
                        type: "POST",
                        beforeSend: function () {
                            before();
                        },
                        success: function (data) {
                            success(data);
                        },
                        error: function () {
                            error();
                        },
                        complete: function () {
                            complete();
                        }
                    });
                }
            })
        }

        // 查询

        function searchData() {

            $("#data").datagrid('load', {
                userName: $("#txtName").val().trim(),
                wechatCode: $("#wechatCode").val().trim(),
                wechatName: $("#wechatName").val().trim(),
                userPhone: $("#txtPhone").val().trim(),
            });
        }

        function before() {
            $.messager.progress({ title: "执行中", text: "" });
        }

        function success(data) {
            $.messager.alert("成功", data.msg, "info");
        }
        function error() {

            $.messager.alert("警告", "系统故障", "error", "")
        }

        function complete() {
            $("#data").datagrid("load");
            $.messager.progress("close");
            $("#formdialog").dialog("close");
        }
    </script>
</head>
<body class="easyui-layout" style="width: 100%; height: 100%">
    <div data-options="region:'center'">
        <table id="data"></table>
        <div id="tool" style="padding: 10px;">
 
            <div style="margin-left: 10px;margin-top:20px;">
                &nbsp
                用户姓名：<input id="txtName" type="text"  onchange="searchData()" />&nbsp&nbsp&nbsp &nbsp&nbsp&nbsp  
                手机号码：<input id="txtPhone" type="text"  onchange="searchData()"/>&nbsp&nbsp&nbsp &nbsp&nbsp&nbsp  
                 微信号： <input id="wechatCode" type="text" onchange="searchData()" style="width:150px" />&nbsp&nbsp&nbsp &nbsp&nbsp&nbsp  
                 微信名称：<input id="wechatName" type="text" onchange="searchData()"  />   
                    
                &nbsp&nbsp&nbsp &nbsp&nbsp&nbsp &nbsp&nbsp&nbsp 
                <a class="easyui-linkbutton" iconcls="icon-search" onclick="searchData()">查询</a>
                  &nbsp&nbsp&nbsp &nbsp&nbsp&nbsp            
                    <a class="easyui-linkbutton" iconcls="icon-remove" onclick="del()">禁用用户</a>
            </div>        
                  
            <div style="margin-top: 20px;margin-left:150px" >

                 &nbsp&nbsp&nbsp  &nbsp&nbsp&nbsp  &nbsp&nbsp&nbsp  &nbsp&nbsp&nbsp<span class="subtotal" style="">今日新增用户：</span>
                <input id="txtToday" type="text" class="subtotal2" />
                &nbsp&nbsp&nbsp<span class="subtotal">总用户量：</span>       
                <input id="txtAll" type="text" class="subtotal2" />   
                   &nbsp&nbsp     &nbsp&nbsp&nbsp<span class="subtotal">人脸审核通过量：</span>       
                <input id="txtFace" type="text" class="subtotal2" /> 
            </div>

        </div>
        <div id="btns">
            <div style="margin-bottom: 10px">
                <a class="easyui-linkbutton" iconcls="icon-redo" onclick="closeDptDialog()">取消</a>
                <a class="easyui-linkbutton" iconcls="icon-add" onclick="save()">保存</a>
            </div>
        </div>
    </div>


        <style type="text/css">
        .subtotal {
            font-weight: bold;
            color: black;
           /*background-color: dodgerblue;*/
            height: 200px;
            width: 200px;
            font-size: 20px;
        }

        .subtotal2 {
            font-weight: bold;
            color: green;
            width: 6%;
            margin-top: 10px;
           background-color:  yellowgreen;
            font-size: 20px;
        }
        /*合计单元格样式*/
    </style>


</body>

</html>
